package com.lightboat.system.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.lightboat.common.utils.DateUtils;
import com.lightboat.system.domain.CrmUserFollowRelation;
import com.lightboat.system.mapper.CrmUserFollowRelationMapper;
import com.lightboat.system.service.ICrmUserFollowRelationService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 用户跟进关系Service业务层处理
 *
 * @author lightboat
 * @date 2025-08-22
 */
@Service
@RequiredArgsConstructor
public class CrmUserFollowRelationServiceImpl extends ServiceImpl<CrmUserFollowRelationMapper, CrmUserFollowRelation> implements ICrmUserFollowRelationService {

    private final CrmUserFollowRelationMapper crmUserFollowRelationMapper;

    /**
     * 查询用户跟进关系
     *
     * @param id 用户跟进关系主键
     * @return 用户跟进关系
     */
    @Override
    public CrmUserFollowRelation selectCrmUserFollowRelationById(Long id) {
        return crmUserFollowRelationMapper.selectById(id);
    }

    /**
     * 查询用户跟进关系列表
     *
     * @param crmUserFollowRelation 用户跟进关系
     * @return 用户跟进关系
     */
    @Override
    public List<CrmUserFollowRelation> selectCrmUserFollowRelationList(CrmUserFollowRelation crmUserFollowRelation) {
        return crmUserFollowRelationMapper.selectCrmUserFollowRelationList(crmUserFollowRelation);
    }

    /**
     * 新增用户跟进关系
     *
     * @param crmUserFollowRelation 用户跟进关系
     * @return 结果
     */
    @Override
    public int insertCrmUserFollowRelation(CrmUserFollowRelation crmUserFollowRelation) {
        crmUserFollowRelation.setCreateTime(DateUtils.getNowDate());
        return crmUserFollowRelationMapper.insert(crmUserFollowRelation);
    }

    /**
     * 修改用户跟进关系
     *
     * @param crmUserFollowRelation 用户跟进关系
     * @return 结果
     */
    @Override
    public int updateCrmUserFollowRelation(CrmUserFollowRelation crmUserFollowRelation) {
        crmUserFollowRelation.setUpdateTime(DateUtils.getNowDate());
        return crmUserFollowRelationMapper.updateById(crmUserFollowRelation);
    }

    /**
     * 批量删除用户跟进关系
     *
     * @param ids 需要删除的用户跟进关系主键
     * @return 结果
     */
    @Override
    public int deleteCrmUserFollowRelationByIds(Long[] ids) {
        return crmUserFollowRelationMapper.deleteCrmUserFollowRelationByIds(ids);
    }

    /**
     * 删除用户跟进关系信息
     *
     * @param id 用户跟进关系主键
     * @return 结果
     */
    @Override
    public int deleteCrmUserFollowRelationById(Long id) {
        return crmUserFollowRelationMapper.deleteCrmUserFollowRelationById(id);
    }
}
